/**
 * Created by leon on 2017/5/8.
 */
(function () {
    'use strict';
    angular.module('App.pages.member')
        .controller('ChangeRalCtrl',ChangeRalCtrl);
    function ChangeRalCtrl(id,$scope,MemberModel,AppUtils){
        $scope.$on('$ionicView.beforeEnter', function (event, viewData) {
            viewData.enableBack = true;
        });
        var vm = this;
        vm.name="";

        vm.test = function (obj) {
            vm.name=obj;

        }
        var objParams={};


        // objParams.memberId='A83FA905F6044E9CA30C52FDCD351794';
        objParams.memberId=id;
        $scope.save=function () {
            objParams.relType=vm.name;
            if(AppUtils.isUndefinedOrNull(objParams)){
                AppUtils.showAlert("请选择亲属关系！");
                return false;
            }

            MemberModel.changeRel(objParams).$promise.then(function(response){
                var result = response.result;
                if(!AppUtils.isUndefinedOrNull(result) && result == 'success'){
                    AppUtils.showAlert("更改成功！");
                    // AppUtils.goBack();
                }
            })
        }

    }
})();